﻿package com.nicoB.tetris.blocks {

	/**
	 * @author n.bush
	 * @project tetris
	 * @date 5 nov. 2008
	 * @desc 
	 */
	public class ABlock {
		
		protected var _rotations : Array;
		private var _stepRotation : uint = 0;
		
		protected var _color : uint = 0xFF3200;
		
		public function ABlock(){
			_rotations = [];
		}
		
		
		public function get width():Number{
			return _rotations[_stepRotation][0].length;
		}
		
		
		public function get height():Number{
			return _rotations[_stepRotation].length;
		}
		
		
		public function rotate(way : int):void {
			var newPosRotation : int = _stepRotation + way;
			
			if (newPosRotation < 0) {
				newPosRotation = _rotations.length - 1;
			}
			
			if (newPosRotation >= _rotations.length)
				newPosRotation = 0;
				
			_stepRotation = newPosRotation;	
		}
		
		
		public function get cells():Array{
			return _rotations[_stepRotation];
		}
		
	}
}
